home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / dsniff / configure.in < prev    next >
Encoding:
Text File  |  2000-05-17  |  5.6 KB  |  224 lines

  1. dnl configure.in
  2. dnl
  3. dnl Copyright (c) 2000 Dug Song <dugsong@monkey.org>
  4. dnl
  5. dnl $Id: configure.in,v 1.12 2000/05/17 17:51:32 dugsong Exp $
  6.  
  7. AC_INIT(dsniff.c)
  8.  
  9. AC_CONFIG_HEADER(config.h)
  10.  
  11. dnl Initialize prefix.
  12. if test "$prefix" = "NONE"; then
  13.    prefix="/usr/local"
  14. fi
  15.  
  16. dnl Checks for programs.
  17. AC_PROG_CC
  18. AC_PROG_INSTALL
  19.  
  20. dnl Checks for header files.
  21. AC_PATH_XTRA
  22. AC_HEADER_STDC
  23. AC_CHECK_HEADERS(err.h fcntl.h sys/ioctl.h unistd.h libgen.h)
  24.  
  25. dnl Checks for typedefs, structures, and compiler characteristics.
  26. AC_C_CONST
  27. AC_TYPE_SIZE_T
  28. AC_STRUCT_TM
  29. dnl XXX - Solaris sux.
  30. AC_CHECK_TYPE(u_int32_t, uint32_t)
  31. dnl XXX - Linux sux.
  32. CFLAGS="$CFLAGS -D_BSD_SOURCE"
  33.  
  34. dnl Checks for library functions.
  35. AC_PROG_GCC_TRADITIONAL
  36. AC_FUNC_MEMCMP
  37. AC_TYPE_SIGNAL
  38. AC_FUNC_STRFTIME
  39. AC_CHECK_FUNCS(gethostname socket strdup strstr)
  40. dnl XXX - Solaris sux.
  41. AC_CHECK_LIB(socket, socket)
  42. AC_CHECK_LIB(nsl, gethostbyname)
  43. dnl XXX - feh, everything except OpenBSD sux.
  44. AC_REPLACE_FUNCS(dirname strlcpy strlcat)
  45. needmd5=no
  46. AC_CHECK_FUNCS(MD5Update, , [needmd5=yes])
  47. if test $needmd5 = yes; then
  48.    LIBOBJS="$LIBOBJS md5.o"
  49.    MD5INC="-I\$(srcdir)/missing"
  50.    AC_SUBST(MD5INC)
  51. fi
  52. neederr=no
  53. AC_CHECK_FUNCS(warnx, , [neederr=yes])
  54. if test $neederr = yes; then
  55.    LIBOBJS="$LIBOBJS err.o"
  56. fi
  57. needethers=no
  58. AC_CHECK_FUNCS(ether_ntoa, , [needethers=yes])
  59. if test $needethers = yes; then
  60.    LIBOBJS="$LIBOBJS ethers.o"
  61. fi
  62.  
  63. dnl Checks for X11
  64. if test "x$no_x" = "x"; then
  65.    WEBSPY="webspy"; AC_SUBST(WEBSPY)
  66. fi
  67.  
  68. dnl Checks for Berkeley DB
  69. AC_MSG_CHECKING(for Berkeley DB with 1.85 compatibility)
  70. AC_ARG_WITH(db,
  71. [  --with-db=DIR           use Berkeley DB (with compat185) build directory],
  72. [ case "$withval" in
  73.   yes|no)
  74.      AC_MSG_RESULT(no)
  75.      ;;
  76.   *)
  77.      AC_MSG_RESULT($withval)
  78.      if test -f $withval/build_unix/db_185.h -a \
  79.          -f $withval/build_unix/libdb.a -a \
  80.          -f $withval/build_unix/db185.o; then
  81.         owd=`pwd`
  82.         if cd $withval; then withval=`pwd`; cd $owd; fi
  83.     AC_DEFINE(HAVE_DB_185_H)
  84.     DBINC="-I$withval/build_unix"
  85.     DBLIB="-L$withval/build_unix -ldb"
  86.      else
  87.         AC_ERROR(db_185.h or libdb.a not found in $withval or not configured with --enable-compat185)
  88.      fi
  89.      ;;
  90.   esac ],
  91. [ if test -f ${prefix}/include/db_185.h; then
  92.      AC_DEFINE(HAVE_DB_185_H)
  93.      DBINC="-I${prefix}/include"
  94.      DBLIB="-L${prefix}/lib -ldb"
  95.   elif test -f /usr/include/db_185.h; then
  96.      AC_DEFINE(HAVE_DB_185_H)
  97.      DBLIB="-ldb"
  98.   elif test -f /usr/include/db.h; then
  99.      AC_DEFINE(HAVE_DB_H)
  100.   else
  101.      AC_ERROR(Berkeley DB with 1.85 compatibility not found)
  102.   fi
  103.   AC_MSG_RESULT(yes) ]
  104. )
  105. AC_SUBST(DBINC)
  106. AC_SUBST(DBLIB)
  107.  
  108. dnl Checks for libpcap
  109. AC_MSG_CHECKING(for libpcap)
  110. AC_ARG_WITH(libpcap,
  111. [  --with-libpcap=DIR      use libpcap build directory],
  112. [ case "$withval" in
  113.   yes|no)
  114.      AC_MSG_RESULT(no)
  115.      ;;
  116.   *)
  117.      AC_MSG_RESULT($withval)
  118.      if test -f $withval/pcap.h -a -f $withval/libpcap.a; then
  119.         owd=`pwd`
  120.         if cd $withval; then withval=`pwd`; cd $owd; fi
  121.     PCAPINC="-I$withval -I$withval/bpf"
  122.     PCAPLIB="-L$withval -lpcap"
  123.      else
  124.         AC_ERROR(pcap.h or libpcap.a not found in $withval)
  125.      fi
  126.      ;;
  127.   esac ],
  128. [ if test -f ${prefix}/include/pcap.h; then
  129.      PCAPINC="-I${prefix}/include"
  130.      PCAPLIB="-L${prefix}/lib -lpcap"
  131.   elif test -f /usr/include/pcap/pcap.h; then
  132.      PCAPINC="-I/usr/include/pcap"
  133.      PCAPLIB="-lpcap"
  134.   elif test -f /usr/include/pcap.h; then
  135.      PCAPLIB="-lpcap"
  136.   else
  137.      AC_MSG_RESULT(no)
  138.      AC_ERROR(libpcap not found)
  139.   fi
  140.   AC_MSG_RESULT(yes) ]
  141. )
  142. AC_SUBST(PCAPINC)
  143. AC_SUBST(PCAPLIB)
  144.  
  145. dnl Checks for libnet
  146. AC_MSG_CHECKING(for libnet)
  147. AC_ARG_WITH(libnet,
  148. [  --with-libnet=DIR       use libnet build directory],
  149. [ case "$withval" in
  150.   yes|no)
  151.      AC_MSG_RESULT(no)
  152.      ;;
  153.   *)
  154.      AC_MSG_RESULT($withval)
  155.      if test -f $withval/include/libnet.h -a -f $withval/lib/libnet.a; then
  156.         owd=`pwd`
  157.         if cd $withval; then withval=`pwd`; cd $owd; fi
  158.     CFLAGS="$CFLAGS `$withval/libnet-config --defines`"
  159.     LNETINC="-I$withval/include"
  160.     LNETLIB="-L$withval/lib -lnet"
  161.      else
  162.         AC_ERROR(libnet.h or libnet.a not found in $withval)
  163.      fi
  164.      ;;
  165.   esac ],
  166. [ if test -f ${prefix}/include/libnet.h; then
  167.      CFLAGS="$CFLAGS `${prefix}/bin/libnet-config --defines`"
  168.      LNETINC="-I${prefix}/include"
  169.      LNETLIB="-L${prefix}/lib -lnet"
  170.   elif test -f /usr/include/libnet.h; then
  171.      CFLAGS="$CFLAGS `libnet-config --defines`"
  172.      LNETLIB="-lnet"
  173.   else
  174.      AC_MSG_RESULT(no)
  175.      AC_ERROR(libnet not found)
  176.   fi
  177.   AC_MSG_RESULT(yes) ]
  178. )
  179. AC_SUBST(LNETINC)
  180. AC_SUBST(LNETLIB)
  181.  
  182. dnl Checks for libnids
  183. AC_MSG_CHECKING(for libnids)
  184. AC_ARG_WITH(libnids,
  185. [  --with-libnids=DIR      use libnids build directory],
  186. [ case "$withval" in
  187.   yes|no)
  188.      AC_MSG_RESULT(no)
  189.      ;;
  190.   *)
  191.      AC_MSG_RESULT($withval)
  192.      if test -f $withval/src/nids.h -a -f $withval/src/libnids.a; then
  193.         owd=`pwd`
  194.         if cd $withval; then withval=`pwd`; cd $owd; fi
  195.     NIDSINC="-I$withval/src"
  196.     NIDSLIB="-L$withval/src -lnids"
  197.      else
  198.         AC_ERROR(nids.h or libnids.a not found in $withval)
  199.      fi
  200.      ;;
  201.   esac ],
  202. [ if test -f ${prefix}/include/nids.h; then
  203.      NIDSINC="-I${prefix}/include"
  204.      NIDSLIB="-L${prefix}/lib -lnids"
  205.   elif test -f /usr/include/nids.h; then
  206.      NIDSLIB="-lnids"
  207.   else
  208.      AC_MSG_RESULT(no)
  209.      AC_ERROR(libnids not found)
  210.   fi
  211.   AC_MSG_RESULT(yes) ]
  212. )
  213. save_cppflags="$CPPFLAGS"
  214. CPPFLAGS="$NIDSINC"
  215. AC_MSG_CHECKING(whether libnids version is good)
  216. AC_EGREP_HEADER(pcap_filter, nids.h, AC_MSG_RESULT(yes), 
  217.    [ AC_MSG_RESULT(no); AC_ERROR(libnids version 1.13 or greater required) ])
  218. CPPFLAGS="$save_cppflags"
  219. AC_SUBST(NIDSINC)
  220. AC_SUBST(NIDSLIB)
  221.  
  222.  
  223. AC_OUTPUT(Makefile)
  224.